package com.hospital.hospitalmedicalrecordservice.web;


import com.hospital.common.vo.ResultEntity;
import com.hospital.hospitalmedicalrecordservice.entity.SeeaboutDto;
import com.hospital.hospitalmedicalrecordservice.entity.Vipperson;
import com.hospital.hospitalmedicalrecordservice.service.IVippersonService;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 会员表 前端控制器
 * </p>
 *
 * @author 韩天雨
 * @since 2020-10-28
 */
@RestController
@RequestMapping("/vipperson")
public class VippersonController {

    @Autowired
    IVippersonService iVippersonService;
    @RequestMapping("vipnum")
    public ResultEntity vipnum(SeeaboutDto seeaboutDto){
        Date date = new Date();
        String newDateStr = DateFormatUtils.format(date,"yyyy-MM-dd");
        //System.out.println(newDateStr);

        String beginTime = newDateStr.concat(" 00:00:00");

        String entTime = newDateStr.concat(" 23:59:59");
        seeaboutDto.setTime1(beginTime);
        seeaboutDto.setTime2(entTime);
        List<Vipperson> vipnum = iVippersonService.vipnum(seeaboutDto);
        System.err.println(vipnum);
        return ResultEntity.ok(vipnum.size());
    }

}
